<?php echo $commander->getListCommandsPanel('sa-a-d', ''); ?>
<div class="menu_list">
<table id="menulist" class="item_list valign_top" cellspacing="0" cellpadding="0" border="0">
	<thead class="fields">
        <tr>
            <th class="first center">&nbsp;&nbsp;Id&nbsp;&nbsp;</th>
            <th><?php echo ucfirst($txt->getWord('choose')); ?></th>
            <th>&nbsp;&nbsp;#&nbsp;&nbsp;</th>
            <th><?php echo ucfirst($txt->getWord('question')); ?></th>
            <th style="display:none;"><?php echo ucfirst($txt->getWord('type')); ?></th>
            <th><?php echo ucfirst($txt->getWord('min_val')); ?></th>
            <th><?php echo ucfirst($txt->getWord('max_val')); ?></th>
            <th><?php echo ucfirst($txt->getWord('order')); ?></th>
            <th><?php echo ucfirst($txt->getWord('active')); ?></th>
            <th class="last"><?php echo ucfirst($txt->getWord('delete')); ?></th>
        </tr>
    </thead>
    <tbody>
        <tr class="items">
            <td class="first center">
            <img 
                	title="<?php echo ucfirst($txt->getWord('new')); ?>"
                    class="icon command" 
                    src="<?php echo SYSICONS_URL; ?>add_16.gif" 
                    onclick="if(document.getElementById('new_ques').value != '') { edit_form.submit(); }" />
            </td>
            <td><input title="<?php echo ucfirst($txt->getWord('all')); ?>" class="select_all" type="checkbox" name="select_all" value="" /></td>
            <td>&nbsp;</td>
            <td>
            	<textarea rows="1" class="txt large autogrow limit_500" id="new_ques" name="new_ques"></textarea><span class="limit"></span>
            </td>
            <td  style="display:none;">
            	<select class="small" name="new_ques_type">
                    <option value="0" selected="selected">
						<?php echo ucfirst($txt->getWord('value_range')); ?>
                    </option>
                </select>
            </td>
            <td colspan="3">&nbsp;</td>
            <td class="center"></td>
            <td class="center last">&nbsp;</td>
        </tr>
        <?php 
		if(isset($surveyAdmin->Survey->Section->Questions)):
		$i = 1;
        foreach($surveyAdmin->Survey->Section->Questions as $question)
        {
			
			?>
			<tr class="items">
				<td class="first center"><?php echo $question->getId(); ?><input type="hidden" name="ques_id[]" value="<?php echo $question->getId(); ?>" /></td>
                <td><input class="select_list" type="checkbox" name="selected[]" value="<?php echo $question->getId(); ?>" /></td>
                <td><?php echo ($question->Order+1); ?>.</td>
				<td><textarea rows="1" class="txt large autogrow limit_500" id="new_ques" name="ques_question[]"><?php echo $question->getQuestion(); ?></textarea></td>
                <td  style="display:none;">
				<select class="small" name="ques_type[]" onchange="submit();">
                    <option value="0" <?php echo getIsSelectedHTML($question->getType(), 0); ?>>
						<?php echo ucfirst($txt->getWord('value_range')); ?>
                    </option>
                </select>
				</td>
                <td>
                	<?php if($question->getType() == 0): ?>
					<input class="xsmall numeric smallint" name="ques_min_val[]" type="text" value="<?php echo $question->getMinValue(); ?>"  />
                    <?php endif; ?>
				</td>
                <td>
					<?php if($question->getType() == 0): ?>
                    <input class="xsmall numeric smallint" name="ques_max_val[]" type="text" value="<?php echo $question->getMaxValue(); ?>"  />
					<?php endif; ?>
				</td>
                <td class="center">
                <select name="ques_order[]" onchange="submit();">
                	<?php 
					for($i=0; $i<count($surveyAdmin->Survey->Section->Questions); $i++)
					{ echo '<option value="'.$i.'" '.getIsSelectedHTML($question->Order, $i).'>'.($i+1).'</option>'; }
					?>
                </select>
                <?php echo $commander->getCommandButton('up', $question->getId()); ?>
                <?php echo $commander->getCommandButton('down', $question->getId()); ?>
                </td>
				<td class="center">
					<?php echo $commander->getActivationFieldsObject($question); ?>
					<input type="hidden" name="ques_active[]" value="<?php echo $question->getActive(); ?>" />
				</td>
				<td class="last center">
					<input title="<?php echo ucfirst($txt->getWord('delete')); ?>" class="inp_image" type="image" name="delete_ques" src="<?php echo SYSICONS_URL; ?>delete_16.gif" value="0" onclick="this.value='<?php echo $question->getId(); ?>'; edit_form.submit();" />
				</td>
			</tr>
			<?php
			$i++;
        }
        endif; 
        ?>
	</tbody>
</table>
</div>